﻿<%@ Page Title="" Language="C#" MasterPageFile="~/WSweb.Master" AutoEventWireup="true" CodeBehind="Brisanje_vijesti.aspx.cs" Inherits="WSweb.Brisanje_vijesti" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        #form1
        {
            width: 100%;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div id="admin-header">
        <div><h1>Administratorsko sučelje</h1></div>
    </div>
    <div id="admin-content">
      <h2><a href="Admin.aspx" title="Idi na unos vijesti">&gt; Unos vijesti</a></h2>
      <h2 style="color: #AEAEAE">&gt; Brisanje vijesti</h2>
        <form id="form1" runat="server">
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:DBwswebCS %>" 
            DeleteCommand="DELETE FROM [Vijest] WHERE [id_vijest] = @original_id_vijest" 
            InsertCommand="INSERT INTO [Vijest] ([naziv], [sadrzaj], [datum], [username], [image], [image_title], [image_id], [image_type], [image_height]) VALUES (@naziv, @sadrzaj, @datum, @username, @image, @image_title, @image_id, @image_type, @image_height)" 
            OldValuesParameterFormatString="original_{0}" 
            SelectCommand="SELECT * FROM [Vijest] ORDER BY [datum]" 
            
            UpdateCommand="UPDATE [Vijest] SET [naziv] = @naziv, [sadrzaj] = @sadrzaj, [datum] = @datum, [username] = @username, [image] = @image, [image_title] = @image_title, [image_id] = @image_id, [image_type] = @image_type, [image_height] = @image_height WHERE [id_vijest] = @original_id_vijest">
            <DeleteParameters>
                <asp:Parameter Name="original_id_vijest" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="naziv" Type="String" />
                <asp:Parameter Name="sadrzaj" Type="String" />
                <asp:Parameter Name="datum" Type="DateTime" />
                <asp:Parameter Name="username" Type="String" />
                <asp:Parameter Name="image" Type="Object" />
                <asp:Parameter Name="image_title" Type="String" />
                <asp:Parameter Name="image_id" Type="Int32" />
                <asp:Parameter Name="image_type" Type="String" />
                <asp:Parameter Name="image_height" Type="Int32" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="naziv" Type="String" />
                <asp:Parameter Name="sadrzaj" Type="String" />
                <asp:Parameter Name="datum" Type="DateTime" />
                <asp:Parameter Name="username" Type="String" />
                <asp:Parameter Name="image" Type="Object" />
                <asp:Parameter Name="image_title" Type="String" />
                <asp:Parameter Name="image_id" Type="Int32" />
                <asp:Parameter Name="image_type" Type="String" />
                <asp:Parameter Name="image_height" Type="Int32" />
                <asp:Parameter Name="original_id_vijest" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
            AutoGenerateColumns="False" DataKeyNames="id_vijest" 
            DataSourceID="SqlDataSource1" Width="919px" AllowSorting="True">
            <Columns>
                <asp:BoundField DataField="id_vijest" HeaderText="ID" InsertVisible="False" 
                    ReadOnly="True" SortExpression="id_vijest">
                <HeaderStyle HorizontalAlign="Center" />
                <ItemStyle HorizontalAlign="Center" Width="40px" />
                </asp:BoundField>
                <asp:BoundField DataField="naziv" HeaderText="Naziv vijesti" 
                    SortExpression="naziv" >
                <ItemStyle Width="300px" />
                </asp:BoundField>
                <asp:BoundField DataField="datum" HeaderText="Datum vijesti" 
                    SortExpression="datum">
                <HeaderStyle HorizontalAlign="Center" />
                <ItemStyle HorizontalAlign="Center" Width="150px" />
                </asp:BoundField>
                <asp:BoundField DataField="username" HeaderText="Autor" 
                    SortExpression="username" >
                <HeaderStyle HorizontalAlign="Center" />
                <ItemStyle HorizontalAlign="Center" />
                </asp:BoundField>
                <asp:BoundField DataField="image_id" HeaderText="ID slike" 
                    SortExpression="image_id">
                <HeaderStyle HorizontalAlign="Center" />
                <ItemStyle HorizontalAlign="Center" Width="30px" />
                </asp:BoundField>
                <asp:BoundField DataField="image_title" HeaderText="Ime slike" 
                    SortExpression="image_title" >
                <ItemStyle Width="100px" />
                </asp:BoundField>
                <asp:BoundField DataField="image_type" HeaderText="Tip slike" 
                    SortExpression="image_type">
                <HeaderStyle HorizontalAlign="Center" />
                <ItemStyle HorizontalAlign="Center" />
                </asp:BoundField>
                <asp:BoundField DataField="image_height" HeaderText="Visina slike" 
                    SortExpression="image_height">
                <ControlStyle Font-Underline="False" ForeColor="White" />
                <HeaderStyle HorizontalAlign="Center" />
                <ItemStyle HorizontalAlign="Center" />
                </asp:BoundField>
                <asp:CommandField DeleteText="Briši" ShowDeleteButton="True">
                <ItemStyle HorizontalAlign="Center" Width="70px" />
                </asp:CommandField>
            </Columns>
            <EmptyDataTemplate>
                Neuspješno čitanje vijesti.
            </EmptyDataTemplate>
        </asp:GridView>
        </form>
     </div>
  
</asp:Content>
